BRIDGENET:=bridgenet

BRIDGENET_BASEDIR:=$(BASEDIR)/$(BRIDGENET)

BRIDGENET_CC:=g++
BRIDGENET_LD:=g++

BRIDGENET_MODULES_DEPENDENCIES:=myfile mythread mynet myudpnet message

BRIDGENET_INCFLAGS:=-I$(BRIDGENET_BASEDIR)/inc -I$(BASEDIR)/common/inc $(patsubst %, -I$(BASEDIR)/%/inc, $(BRIDGENET_MODULES_DEPENDENCIES))

ifeq ($(SYSTEM), MINGW32_NT-5.1)
BRIDGENET_DEBUG_CFLAGS:=-g -Wall -W -pedantic -Woverloaded-virtual -D_REENTRANT -DDEBUG $(BRIDGENET_INCFLAGS)
BRIDGENET_DEBUG_LDFLAG:=
BRIDGENET_DEBUG_LIBS:=

BRIDGENET_RELEASE_CFLAGS:=-Wall -W -pedantic -Woverloaded-virtual -D_REENTRANT -DRELEASE $(BRIDGENET_INCFLAGS)
BRIDGENET_RELEASE_LDFLAG:=
BRIDGENET_RELEASE_LIBS:=
endif

ifeq ($(SYSTEM), Linux)
BRIDGENET_DEBUG_CFLAGS:=-g -Wall -W -fPIC -pedantic -Woverloaded-virtual -D_REENTRANT -DDEBUG $(BRIDGENET_INCFLAGS)
BRIDGENET_DEBUG_LDFLAG:=
BRIDGENET_DEBUG_LIBS:=

BRIDGENET_RELEASE_CFLAGS:=-Wall -W -fPIC -pedantic -Woverloaded-virtual -D_REENTRANT -DRELEASE $(BRIDGENET_INCFLAGS)
BRIDGENET_RELEASE_LDFLAG:=
BRIDGENET_RELEASE_LIBS:=

endif

BRIDGENET_SRC:=$(shell ls 2>&1 $(BRIDGENET_BASEDIR)/src/*.cpp)

TMP_BRIDGENET_OBJ:= $(patsubst %.cpp,%.o,$(filter %.cpp,$(BRIDGENET_SRC)))
TMP_BRIDGENET_DEP:= $(patsubst %.cpp,%.d,$(filter %.cpp,$(BRIDGENET_SRC)))

SRC+=$(BRIDGENET_SRC)

BRIDGENET_DEBUG_OBJS=$(shell echo $(TMP_BRIDGENET_OBJ) | sed -e 's@src@obj/debug@g' )
BRIDGENET_RELEASE_OBJS+=$(shell echo $(TMP_BRIDGENET_OBJ) | sed -e 's@src@obj/release@g' )

DEBUG_OBJS+=$(BRIDGENET_DEBUG_OBJS)
RELEASE_OBJS+=$(BRIDGENET_RELEASE_OBJS)

# Dependencies are release independant.
DEPS+=$(shell echo $(TMP_BRIDGENET_DEP) | sed -e 's@src@dep@g' )

DEBUG_BRIDGENET_ARCHIVE:=$(BASEDIR)/lib/debug/$(BRIDGENET).a
RELEASE_BRIDGENET_ARCHIVE:=$(BASEDIR)/lib/release/$(BRIDGENET).a

DEBUG_BRIDGENET_LIB:=$(BASEDIR)/lib/debug/lib$(BRIDGENET).so
RELEASE_BRIDGENET_LIB:=$(BASEDIR)/lib/release/lib$(BRIDGENET).so

DEBUG_ARCHIVES+=$(DEBUG_BRIDGENET_ARCHIVE)
RELEASE_ARCHIVES+=$(RELEASE_BRIDGENET_ARCHIVE)

DEBUG_LIBS+=$(DEBUG_BRIDGENET_LIB)
RELEASE_LIBS+=$(RELEASE_BRIDGENET_LIB)
